﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Entity;
namespace BLL
{
    public class NewsClass
    {
        DAL.NewsClass dal = new DAL.NewsClass();
        /// <summary>
        /// 添加类
        /// </summary>
        /// <param name="newsModel">newsclass模型</param>
        /// <returns>返回受影响的行数</returns>
        public int AddClass(Model.NewsClass newsModel)
        {
            return dal.AddClass(newsModel);
        }

        /// <summary>
       /// 修改一条数据
       /// </summary>
       /// <param name="model">新闻模型</param>
        public void UpdateRow(BoNewsClass model)
        {
            dal.UpdateRow(model);
        }

          /// <summary>
       /// 添加一条记录
       /// </summary>
       /// <param name="model">实体类</param>
       /// <returns></returns>
        public void Insert(BoNewsClass model)
        {
            model.NCId = System.Guid.NewGuid().ToString();
            dal.Insert(model);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="newsModel">newsclass模型</param>
        /// <returns>返回受影响的行数</returns>
        public int updateClass(Model.NewsClass newsModel)
        {
            return dal.updateClass(newsModel);
        }
        /// <summary>
        /// 根据id来删除一条数据
        /// </summary>
        /// <param name="id">id值</param>
        /// <returns>返回删除的行数</returns>
        public int DelClass(string id)
        {
            new NewsContent().DeleteByClassId(id);
            return dal.DelClass(id);
        }
        /// <summary>
        /// 得到父类子类排序后的列表
        /// </summary>
        /// <returns>返回排序后的表</returns>
        //public DataTable GetOrderNewsClass(int ParentId)
        //{
        //    return dal.GetOrderNewsClass(ParentId);
        //}
        /// <summary>
        /// 根据id和列名获取此行某个特定值
        /// </summary>
        /// <param name="id">id号</param>
        /// <returns>返回长发的ClassLayer</returns>
        public object getCell(int id, string Column)
        {
            return dal.getCell(id, Column);
        }
        /// <summary>
        /// 获取NewsClass的表中的数据
        /// </summary>
        /// <returns>NewsClass表中的数据</returns>
        public DataTable GetNewsClass()
        {
            return dal.GetNewsClass();
        }
        /// <summary>
        /// 向ContestClass中添加一行数据
        /// </summary>
        /// <param name="Title">标题</param>
        /// <param name="ParentId">父Id</param>
        /// <param name="ClassLayer">类别所属层</param>
        /// <returns></returns>
        public int AddContestClass(string Title, bool IsShow)
        {
            return dal.AddContestClass(Title, IsShow);
        }
        /// <summary>
        /// 根据id删除此行数据
        /// </summary>
        /// <param name="id">id值</param>
        /// <returns>返回删除的行数</returns>
        public int delSingle(string id)
        {
            return dal.delSingle(id);
        }
    }
}
